package servlet.zhouchao;

import pojo.Goods;
import service.GoodsService;
import service.impl.GoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(value = "/GoodsDetailsServlet")
public class GoodsDetailsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String goId=request.getParameter("goId");
        GoodsService goodsService=new GoodsServiceImpl();
        Goods goods=new Goods();
        goods=goodsService.queryGoodsInfo(Integer.parseInt(goId));
        request.setAttribute("go",goods);
        request.getRequestDispatcher("jsp/zc/GoodsDetails.jsp").forward(request,response);
    }
}
